/*
 * @Author: 大D
 * @email: 857216393@qq.com
 * @Date: 2024-01-24 09:46:28
 * @Description: 临时用户存储 用于评论
 */
import { defineStore } from 'pinia';
import type { IUser } from '@/apis/type';

export const useCasualUser = defineStore(
  'casualUserStorage',
  () => {
    const casualUser = ref({} as IUser);
    const getCasualUser = () => {
      return casualUser.value;
    };
    const setCasualUser = (val: IUser) => {
      casualUser.value = val;
    };
    const removeCasualUser = () => {
      localStorage.removeItem('casualUserStorage');
    };
    return { casualUser, getCasualUser, setCasualUser, removeCasualUser };
  },
  { persist: true }
);
